using System;
using System.Collections.Generic;


namespace DataObjects
{
	[Serializable]
	public class Voucher: IEquatable<Voucher>
	{

		#region Private Members

		private string _voucher_no; 
		private DateTime? _date_of_voucher; 
		private string _employee_id; 
		private string _customer_name_direct; 
		private string _ticket_no; 
		private string _transport_id; 
		private string _service_id; 
		private string _tour; 
		private string _remark; 
		private string _provider_id; 
		private string _provider_person_represent; 
		private double _buy_total;  
		private double _buy_vat_percent; 
		private double _buy_vat; 
		private double _buy_sum; 
		private string _buy_currency; 
		private double _buy_exchange; 
		private double _buy_sum_vnd; 
		private string _customer_id; 
		private string _customer_person_represent; 
		private double _sale_total;  
		private double _sale_vat_percent; 
		private double _sale_vat; 
		private double _sale_sum; 
		private string _sale_currency; 
		private double _sale_exchange; 
		private double _sale_sum_vnd;
        private double _sale_commission;
		private string _status; 		
		#endregion

		#region Constructor

		public Voucher()
		{
			_voucher_no = String.Empty; 
			_date_of_voucher = new DateTime?(); 
			_employee_id = String.Empty; 
			_customer_name_direct = String.Empty; 
			_ticket_no = String.Empty; 
			_transport_id = String.Empty; 
			_service_id = String.Empty; 
			_tour = String.Empty; 
			_remark = String.Empty; 
			_provider_id = String.Empty; 
			_provider_person_represent = String.Empty; 
			_buy_total = new double();  
			_buy_vat_percent = new double(); 
			_buy_vat = new double(); 
			_buy_sum = new double(); 
			_buy_currency = String.Empty; 
			_buy_exchange = new double(); 
			_buy_sum_vnd = new double(); 
			_customer_id = String.Empty; 
			_customer_person_represent = String.Empty; 
			_sale_total = new double();  
			_sale_vat_percent = new double(); 
			_sale_vat = new double(); 
			_sale_sum = new double(); 
			_sale_currency = String.Empty; 
			_sale_exchange = new double(); 
			_sale_sum_vnd = new double();
            _sale_commission = new double();
			_status = String.Empty; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public Voucher(
			string voucher_no)
			: this()
		{
			_voucher_no = voucher_no;
			_date_of_voucher = null;
			_employee_id = String.Empty;
			_customer_name_direct = String.Empty;
			_ticket_no = String.Empty;
			_transport_id = String.Empty;
			_service_id = String.Empty;
			_tour = String.Empty;
			_remark = String.Empty;
			_provider_id = String.Empty;
			_provider_person_represent = String.Empty;
			_buy_total = 0;
			_buy_vat_percent = 0;
			_buy_vat = 0;
			_buy_sum = 0;
			_buy_currency = String.Empty;
			_buy_exchange = 0;
			_buy_sum_vnd = 0;
			_customer_id = String.Empty;
			_customer_person_represent = String.Empty;
			_sale_total = 0;
			_sale_vat_percent = 0;
			_sale_vat = 0;
			_sale_sum = 0;
			_sale_currency = String.Empty;
			_sale_exchange = 0;
			_sale_sum_vnd = 0;
            _sale_commission = 0;
			_status = String.Empty;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual string VoucherNo
		{
			get
			{ 
				return _voucher_no;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for VoucherNo", value, "null");
				
				if(  value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for VoucherNo", value, value.ToString());
				
				_voucher_no = value;
			}
		}
			
		public virtual DateTime? DateOfVoucher
		{
			get
			{ 
				return _date_of_voucher;
			}
			set
			{
				_date_of_voucher = value;
			}

		}
			
		public virtual string EmployeeId
		{
			get
			{ 
				return _employee_id;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for EmployeeId", value, value.ToString());
				
				_employee_id = value;
			}
		}
			
		public virtual string CustomerNameDirect
		{
			get
			{ 
				return _customer_name_direct;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for CustomerNameDirect", value, value.ToString());
				
				_customer_name_direct = value;
			}
		}
			
		public virtual string TicketNo
		{
			get
			{ 
				return _ticket_no;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for TicketNo", value, value.ToString());
				
				_ticket_no = value;
			}
		}
			
		public virtual string TransportId
		{
			get
			{ 
				return _transport_id;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for TransportId", value, value.ToString());
				
				_transport_id = value;
			}
		}
			
		public virtual string ServiceId
		{
			get
			{ 
				return _service_id;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for ServiceId", value, value.ToString());
				
				_service_id = value;
			}
		}
			
		public virtual string Tour
		{
			get
			{ 
				return _tour;
			}

			set	
			{	
				if(  value != null &&  value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for Tour", value, value.ToString());
				
				_tour = value;
			}
		}
			
		public virtual string Remark
		{
			get
			{ 
				return _remark;
			}

			set	
			{	
				if(  value != null &&  value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for Remark", value, value.ToString());
				
				_remark = value;
			}
		}
			
		public virtual string ProviderId
		{
			get
			{ 
				return _provider_id;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for ProviderId", value, value.ToString());
				
				_provider_id = value;
			}
		}
			
		public virtual string ProviderPersonRepresent
		{
			get
			{ 
				return _provider_person_represent;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for ProviderPersonRepresent", value, value.ToString());
				
				_provider_person_represent = value;
			}
		}
			
		public virtual double BuyTotal
		{
			get
			{ 
				return _buy_total;
			}
			set
			{
				_buy_total = value;
			}

		}
			
		public virtual double BuyVatPercent
		{
			get
			{ 
				return _buy_vat_percent;
			}
			set
			{
				_buy_vat_percent = value;
			}

		}
			
		public virtual double BuyVat
		{
			get
			{ 
				return _buy_vat;
			}
			set
			{
				_buy_vat = value;
			}

		}
			
		public virtual double BuySum
		{
			get
			{ 
				return _buy_sum;
			}
			set
			{
				_buy_sum = value;
			}

		}
			
		public virtual string BuyCurrency
		{
			get
			{ 
				return _buy_currency;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for BuyCurrency", value, value.ToString());
				
				_buy_currency = value;
			}
		}
			
		public virtual double BuyExchange
		{
			get
			{ 
				return _buy_exchange;
			}
			set
			{
				_buy_exchange = value;
			}

		}
			
		public virtual double BuySumVnd
		{
			get
			{ 
				return _buy_sum_vnd;
			}
			set
			{
				_buy_sum_vnd = value;
			}

		}
			
		public virtual string CustomerId
		{
			get
			{ 
				return _customer_id;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for CustomerId", value, value.ToString());
				
				_customer_id = value;
			}
		}
			
		public virtual string CustomerPersonRepresent
		{
			get
			{ 
				return _customer_person_represent;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for CustomerPersonRepresent", value, value.ToString());
				
				_customer_person_represent = value;
			}
		}
			
		public virtual double SaleTotal
		{
			get
			{ 
				return _sale_total;
			}
			set
			{
				_sale_total = value;
			}

		}
			
		public virtual double SaleVatPercent
		{
			get
			{ 
				return _sale_vat_percent;
			}
			set
			{
				_sale_vat_percent = value;
			}

		}
			
		public virtual double SaleVat
		{
			get
			{ 
				return _sale_vat;
			}
			set
			{
				_sale_vat = value;
			}

		}
			
		public virtual double SaleSum
		{
			get
			{ 
				return _sale_sum;
			}
			set
			{
				_sale_sum = value;
			}

		}
			
		public virtual string SaleCurrency
		{
			get
			{ 
				return _sale_currency;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for SaleCurrency", value, value.ToString());
				
				_sale_currency = value;
			}
		}
			
		public virtual double SaleExchange
		{
			get
			{ 
				return _sale_exchange;
			}
			set
			{
				_sale_exchange = value;
			}

		}
			
		public virtual double SaleSumVnd
		{
			get
			{ 
				return _sale_sum_vnd;
			}
			set
			{
				_sale_sum_vnd = value;
			}

		}

        public virtual double SaleCommission
        {
            get
            {
                return _sale_commission;
            }
            set
            {
                _sale_commission = value;
            }

        }
			
		public virtual string Status
		{
			get
			{ 
				return _status;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for Status", value, value.ToString());
				
				_status = value;
			}
		}
			
				
		#endregion 

		#region Public Functions

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			Voucher castObj = (Voucher)obj; 
			return ( castObj != null ) &&
				( this._voucher_no == castObj.VoucherNo );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _voucher_no.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(Voucher other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._voucher_no == other.VoucherNo );
				   
		}

		#endregion
		
	}
}
